home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5606 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.infoserve.net!usenet
  2. From: paveltka@unix.infoserve.net (Pavel Tkatchouk)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Stupid Q: what's wrong?
  5. Date: Mon, 05 Feb 1996 19:22:03 GMT
  6. Message-ID: <4f5lu9$s7o@news.infoserve.net>
  7. References: <4ejerd$r84@news.infoserve.net> <DM1wpD.Lqp@iquest.net>
  8. NNTP-Posting-Host: unix.infoserve.net
  9. X-Newsreader: Forte Free Agent v0.55
  10.  
  11. jeffl@inter-intelli.com (Jeff Lindholm) wrote:
  12.  
  13. >char c;
  14. >c = *ptr;
  15. >strcat(szC,&c); // will start at address of c and move until it hits a '\0' 
  16. >in memory somewhere
  17.  
  18. >That will most likely step on the stack. By throwing in a cout << you are 
  19. >pushing the stack around. If you really need to do the above try.
  20.  
  21. >char c[2];
  22. >c[1] = '\0';
  23. >.
  24. >other code
  25. >.
  26. >*c = *ptr;
  27. >strcat(sz, c);
  28.  
  29. Hi, Jeff:
  30.  
  31. 1.This way program still doesn't work right. But that's because of my
  32. bad algorithm not becouse of your correction.
  33.  
  34. 2. You do gave me a clue. After I have initialized char c='\0',
  35. program started to work properly. So, thank you very much.
  36. There are still some problems with precision but in general it works.
  37.  
  38. Thanks again,
  39.  
  40. Pavel
  41.  
  42.